package isquirrel;

import java.util.Vector;

import isquirrel.beans.YouTubeVideo;

public class YouTubeCollection {

	private Vector<YouTubeVideo> _videos = null;
	private int _workers = 0; 
	
	public YouTubeCollection(){
		
		_videos = new Vector<YouTubeVideo>();
		
	}
	
	public synchronized void add(Vector<YouTubeVideo> workervideos){
	
		_videos.addAll(workervideos);
		
	}
	
	public Vector<YouTubeVideo> videos(){
		
		return _videos;
	}
	
	public void incrementWorkers(){
		
		++_workers;
		
	}
	
	public synchronized void decrementWorkers(){
		
		--_workers;
		
	}
	
	public boolean workersDone(){
		
		return _workers == 0;
		
	}
}
